package com.medical_system.dao.impl;

import java.sql.ResultSet;

import com.medical_system.dao.ZhangHaoDao;
import com.medical_system.util.JDBCUtil;


public class ZhangHaoDaoImpl implements ZhangHaoDao{
	JDBCUtil jdbc = JDBCUtil.getInit();

	@Override
	public String Name(String str) {
		String sql = "select t_name from t_zh where t_zh=?";
		ResultSet rs = jdbc.query(sql, str);
		try {
			if(rs.next()) {
				return rs.getString("t_name");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	public boolean selectZH(String str1,String str2,String str3) {
		String sql = "select t_"+str1+" from t_zh where t_zh=?";
		ResultSet rs = jdbc.query(sql,str2);
		try {
			while(rs.next()) {
				return str3.equals(rs.getString("t_"+str1));
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			jdbc.closeAll();
		}
		return false;
	}

}
